//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package study.API;

import java.util.ArrayList;
import java.util.Collections;

public class ArrayListDemo {
    public ArrayListDemo() {
    }

    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList();
        list.add(1);
        list.add(2);
        list.add(3);
        list.add(4);
        int index = Collections.binarySearch(list, 4);
        if (index < 0) {
            index = -(index + 1);
            list.add(index, 4);
        } else {
            list.add(index, 4);
        }

    }
}
